<template>
    <div class="new-main">
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in list">
                <router-link :to="'/home/newsinfo/'+ item.id">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        <h3>{{item.title}}</h3>
                        <div class="bottom">
                            <div class="time">{{item.add_time | timeFormat}}</div>
                            <div class="click">点击：<span>{{item.click}}</span>次</div>
                        </div>
                    </div>
                </router-link>
            </li>


        </ul>
    </div>
</template>

<script>
    import axios from "axios"
    export default {
        name: "new",
        data(){
            return{
                list: {}
            }
        },
        methods:{
          getnews(){
              axios.get("/api/getnewslist")
                  .then( (res)=>{
                      // console.log(res)
                      this.list = res.data.message
                  })
                  .catch((err)=>{
                      console.log(err)
                  })
          }
        },
        created(){
            this.getnews();
        }
    }
</script>

<style scoped lang="less">
    .new-main{

        h3{
            font-size: 14px;
        }
        .bottom{
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            color: #007aff;
        }
    }
</style>